Do the same enclosure quoting hack on input for MXF.
authorrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 3 Dec 2005 03:22:06 +0000 (03:22 +0000)
committerrobertl <robertl@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 3 Dec 2005 03:22:06 +0000 (03:22 +0000)
gpsbabel/csv_util.c
gpsbabel/internal_styles.c
gpsbabel/style/mxf.style

index 00be882f05d4efcb8b4153ee5a1b16b2fe9ecac6..e7299f667f19c4d8656ee28399e2770353c81456 100644 (file)
@@ -752,6 +752,10 @@ time_to_yyyymmdd(time_t t)
 static void
 xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
 {
+    char *enclosure = "";
+    if (0 == strcmp(fmp->printfc, "\"%s\"")) {
+       enclosure = "\"";
+    }
     if (strcmp(fmp->key, "IGNORE") == 0) {
        /* IGNORE -- Categorically ignore this... */
     } else
@@ -765,10 +769,10 @@ xcsv_parse_val(const char *s, waypoint *wpt, const field_map_t *fmp)
        /* IGNORE -- Calculated Sequence # For Ouput*/
     } else
     if (strcmp(fmp->key, "SHORTNAME") == 0) {
-       wpt->shortname = csv_stringtrim(s, "", 0);
+       wpt->shortname = csv_stringtrim(s, enclosure, 0);
     } else
     if (strcmp(fmp->key, "DESCRIPTION") == 0) {
-       wpt->description = csv_stringtrim(s, "", 0);
+       wpt->description = csv_stringtrim(s, enclosure, 0);
     } else
     if (strcmp(fmp->key, "NOTES") == 0) {
        wpt->notes = csv_stringtrim(s, "", 0);
index e1724fe13a60db48bd6cff5ac49788da54fc83cc..fabd988a9d5f2627dedeafff34fe55f24ccc685a 100644 (file)
@@ -463,8 +463,8 @@ static char mxf[] =
 "#\n"
 "IFIELD        LAT_DECIMAL, \"\", \"%08.5f\"\n"
 "IFIELD        LON_DECIMAL, \"\", \"%08.5f\"\n"
-"IFIELD        DESCRIPTION, \"\", \"%s\"\n"
-"IFIELD        SHORTNAME, \"\", \"%s\"\n"
+"IFIELD        DESCRIPTION, \"\", \"\"%s\"\"\n"
+"IFIELD        SHORTNAME, \"\", \"\"%s\"\"\n"
 "IFIELD        IGNORE, \"\", \"%s\"\n"
 "IFIELD        CONSTANT, \"ff0000\", \"%s\"    # COLOR\n"
 "IFIELD        CONSTANT, \"47\", \"%s\"                # ICON\n"
index 606f40bb332d2d81e98d7d2fcc0479461b3beab1..08d35e7d6d45a1be1548026af79586a6ce2b2c29 100644 (file)
@@ -24,8 +24,8 @@ BADCHARS              ,"
 #
 IFIELD LAT_DECIMAL, "", "%08.5f"
 IFIELD LON_DECIMAL, "", "%08.5f"
-IFIELD DESCRIPTION, "", "%s"
-IFIELD SHORTNAME, "", "%s"
+IFIELD DESCRIPTION, "", ""%s""
+IFIELD SHORTNAME, "", ""%s""
 IFIELD IGNORE, "", "%s"
 IFIELD CONSTANT, "ff0000", "%s"        # COLOR
 IFIELD CONSTANT, "47", "%s"            # ICON